
public class CommissionEmployee extends Employee

{

	private double grossSale;
	private double commissionRate;
	
	public CommissionEmployee(String first, String last, String ssn, double sales, double rate)
	{
		super(first,last,ssn);
		setgrossSale(sales);
		setcommissionRate(rate);		
	}
	

	public void setgrossSale(double sales)
	{
		grossSale = (sales < 0.0) ? 0.0 : sales;
	}
	public double getgrossSale()
	{
		return grossSale;
	}
	
	
	public void setcommissionRate(double rate)
	{
		commissionRate = (rate<0.0 || rate>1.0) ? 0.0 : rate;
	}
	public double getcommissionRate()
	{
		return commissionRate;
	}
	
	
	@Override
	public double earnings()
	{
		return (getcommissionRate()*getgrossSale());
	}
	
	@Override
	public String toString()
	{
		String temp = "First Name: " + getfirstName() + "\n" + 
						"Last Name: " +  getlastName() + "\n" +
						 "SSN: " + getSsn() + "\n" +
						"Gross Sale: " + getgrossSale()+ "\n" +
						 "CommissionRate: " + getcommissionRate() + "\n" +
						 "Salary: " + earnings() + "\n";
						
		return temp;
	}
	
	
	
}
